#include "graph_support/fakes/BusinessType.h"

namespace test_gs_fakes
{

BusinessType::BusinessType( const char * businessInfo )
	: businessInfo( businessInfo )
{
}

BusinessType::BusinessType()
	: businessInfo( "" )
{
}

const std::string & BusinessType::getBusinessInfo() const
{
	return businessInfo;
}

bool BusinessType::operator == ( const BusinessType & that ) const
{
	return businessInfo == that.businessInfo;
}

// ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###

size_t BsnsHashMapSupport::operator () ( const BusinessType & bt ) const
{
	return stdext::hash< const char * >() ( bt.getBusinessInfo().c_str() );
}

bool BsnsHashMapSupport::operator () ( const BusinessType & a, const BusinessType & b ) const
{
	return a.getBusinessInfo() == b.getBusinessInfo();
}

// ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###

ExtBusiness::ExtBusiness( const char * businessInfo )
	: BusinessType( businessInfo )
{
}

ExtBusiness::operator const std::string & () const
{
	return getBusinessInfo();
}

const ExtBusiness & ExtBusiness::operator = ( const std::string & businessInfo )
{
	BusinessType & snThis = * this;
	snThis = BusinessType( businessInfo.c_str() );
	return * this;
}

}
